import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    user: JSON.parse(localStorage.getItem('user')) || '',
    token: localStorage.getItem('token') || '',
    admin: JSON.parse(localStorage.getItem('admin')) || '',
    adminToken: localStorage.getItem('adminToken') || ''
  },
  getters: {
    uName: (state) => state.user.uName
  }
})

export default store
